<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>prototype</title>
</head>
<body>


<script>
    function Person() {

    }
    Person.prototype.name="peter";
    Person.prototype.age=19;
    Person.prototype.job="doctor";
    Person.prototype.sayName=function () {
        console.log(this.name);
    }
    var person1=new Person();
    person1.sayName();

    var person2=new Person();
    person2.sayName();

    //使用对象字面量重写原型对象
    Person.prototype={
        name:"peter",
        age:20,
        job:"doctor",
        sayName:function () {
            console.log(this.name);
        }
    }


</script>


</body>
</html>